// Kony

#pragma once

#include "CoreMinimal.h"
#include "AttributeSet.h"
#include "AbilitySystemComponent.h"
#include "BaseAttributeSet.generated.h"

// 前置声明
struct FGameplayEffectModCallbackData;


#define ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \
	GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
	GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
	GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
	GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName)


//效果属性结构体
USTRUCT()
struct FEffectProperties
{
	GENERATED_BODY()
	FEffectProperties(){}
	//游戏效果上下文处理器
	FGameplayEffectContextHandle EffectContextHandle;
	//源能力系统组件
	UPROPERTY()
	UAbilitySystemComponent* SourceASC = nullptr;
	//指向技能释放者的Avatar角色（通常是可见的Pawn/Character实例）
	UPROPERTY()
	AActor* SourceAvatarActor = nullptr;

	//源玩家控制器
	UPROPERTY()
	AController* SourceController = nullptr;

	//源角色
	UPROPERTY()
	ACharacter* SourceCharacter = nullptr;

	//目标能力系统组件
	UPROPERTY()
	UAbilitySystemComponent* TargetASC = nullptr;
	
	// 指向技能作用目标的Avatar角色（通常是受击Pawn/Character）
	// - 用于伤害计算、受击效果播放等逻辑
	// - 在AOE技能中可能指向多个目标（需配合TargetData使用）
	// - 通过GetAvatarActorFromActorInfo()获取最新引用
	UPROPERTY()
	AActor* TargetAvatarActor = nullptr;

	//目标玩家控制器
	UPROPERTY()
	AController* TargetController = nullptr;

	//目标角色
	UPROPERTY()
	ACharacter* TargetCharacter = nullptr;
	
	
};
//typedef 用于指定类型别名 template 用于创造通用模板
//typedef TBaseStaticDelegateInstance<FGameplayAttribute(),FDefaultDelegateUserPolicy>::FFuncPtr FAttributeFuncPtr;
template<class T>
using TStaticFuncPtr = typename TBaseStaticDelegateInstance<T, FDefaultDelegateUserPolicy>::FFuncPtr;
/**
 * 这是属性集的基类
 */
UCLASS()
class GASC_HUANLING_API UBaseAttributeSet : public UAttributeSet
{
	GENERATED_BODY()

public:
	UBaseAttributeSet();

	/* 开始设置属性集 */
	virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
	
	//在属性值改变之前调用，用于对即将改变的值进行约束或修改（用于判断数值检少 不可超过限制，避免负数）
	virtual void PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue) override;

	//在属性值改变之后调用，用于对改变后的值进行计算和逻辑处理
	virtual void PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data) override;
	//在属性值改变之后调用，用于处理属性变化后的逻辑（如更新UI、触发事件等）
	virtual void PostAttributeChange(const FGameplayAttribute& Attribute, float OldValue, float NewValue) override;

	
	//用于广播 游戏标签和属性之间的映射
	/*
	 * GAS自带的 静态委托（Static Delegate）机制 FGameplayAttribute(*)() 简写
	 * 或者 typedef 别名 FAttributeFuncPtr 方式
	 * 或者 使用 template<class T> 模板 TStaticFuncPtr<FGameplayAttribute()> 其中的 FGameplayAttribute可随意更换
	 * TBaseStaticDelegateInstance<FGameplayAttribute(),FDefaultDelegateUserPolicy>::FFuncPtr
	 * 声明一个函数指针 FunctionPointer，类型为 TBaseStaticDelegateInstance 的静态委托实例的函数指针类型。
	 * 这个函数指针类型用于返回一个 FGameplayAttribute（游戏属性类型），不接受任何参数。
	 * FDefaultDelegateUserPolicy 是默认的委托用户策略，用于控制绑定和调用行为。
	 * 此函数指针通常用于与 GameplayTag（游戏标签）关联，实现：
	 * 根据标签 -> 找到对应的 GameplayAttribute（游戏属性）
	 * 这是 GAS 系统中支持标签与属性之间映射的一种底层机制，可用于简化技能、效果和属性之间的逻辑映射。
	 */
	TMap<FGameplayTag,TStaticFuncPtr<FGameplayAttribute()>> TagsToAttributes;
	
	//测试模板用示例 随机函数指针
	// TStaticFuncPtr<float(int32,float,int32)> RandomFunctionPointer;
	// static float RandomFunction(int32 I,float F,int32 I2) {return 0.f;}
	
	/**
	 * BlueprintReadOnly 设置蓝图可访问
	 * ReplicatedUsing 设置可复制 用于服务端同步数据使用
	 * OnRep_Health
	 * ATTRIBUTE_ACCESSORS是代替GAMEPLAYATTRIBUTE_PROPERTY_GETTER的宏，在上面标记
	 *  **/
	/*
	 * 等级属性 Level Attributes
	 */
	//玩家总等级 这个不显示到界面
	// UPROPERTY(VisibleAnywhere, ReplicatedUsing = OnRep_Level, Category = "Level Attributes")
	// FGameplayAttributeData Level;
	// ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Level);

	//经验值 修为值, ReplicatedUsing = OnRep_XP
	// UPROPERTY(VisibleAnywhere, Category = "Level Attributes")
	// FGameplayAttributeData XP;
	// ATTRIBUTE_ACCESSORS(UBaseAttributeSet, XP);
	//
	// //灵气值 用于转换修为或者修炼法术等级 , ReplicatedUsing = OnRep_LingQi
	// UPROPERTY(VisibleAnywhere, Category = "Level Attributes")
	// FGameplayAttributeData LingQi;
	// ATTRIBUTE_ACCESSORS(UBaseAttributeSet, LingQi);
	//
	// //修为通过总等级计算而来
	// //玩家修为、凡人、练气层、筑基、金丹、元婴 等
	// UPROPERTY(VisibleAnywhere, ReplicatedUsing = OnRep_Cultivation, Category = "Level Attributes")
	// FGameplayAttributeData Cultivation;
	// ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Cultivation);
	//
	// //玩家修为当前层数、凡人、练气1-13层、筑基9层、金丹9层、元婴9层 等
	// UPROPERTY(VisibleAnywhere, ReplicatedUsing = OnRep_CultivationTier, Category = "Level Attributes")
	// FGameplayAttributeData CultivationTier;
	// ATTRIBUTE_ACCESSORS(UBaseAttributeSet, CultivationTier);
	//
	// //当前修为小等级：每个境界 1~10级 这个是循环的 只有1-10级 例如练气1层10阶
	// UPROPERTY(VisibleAnywhere, ReplicatedUsing = OnRep_CultivationStage, Category = "Level Attributes")
	// FGameplayAttributeData CultivationStage;
	// ATTRIBUTE_ACCESSORS(UBaseAttributeSet, CultivationStage);

	/*
	 * 主要属性 Primary Attributes
	 */
	//力量 - 力道 物理攻击强度 一些物品需要用到力量
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_Strength, Category = "Primary Attributes")
	FGameplayAttributeData Strength; 
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Strength);

	//智力 - 灵力 影响法力值和魔法攻击力
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_Intelligence, Category = "Primary Attributes")
	FGameplayAttributeData Intelligence; 
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Intelligence);

	//魂力 SoulPower - 精神力量、符咒-控制、御物、召唤、灵识类技能效果 伤害
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_SoulPower, Category = "Primary Attributes")
	FGameplayAttributeData SoulPower; 
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, SoulPower);

	// Resilience 恢复能力 - 定力
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_Resilience, Category = "Primary Attributes")
	FGameplayAttributeData Resilience; 
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Resilience);

	// Vigor 活力 - 体魄
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_Vigor, Category = "Primary Attributes")
	FGameplayAttributeData Vigor; 
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Vigor);

	// Spirit 神识
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_Spirit, Category = "Primary Attributes")
	FGameplayAttributeData Spirit; 
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Spirit);

	//Agility 身法
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_Agility, Category = "Primary Attributes")
	FGameplayAttributeData Agility; 
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Agility);

	//洞察 Insight 命中几率、暴击几率
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_Insight, Category = "Primary Attributes")
	FGameplayAttributeData Insight; 
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Insight);
	
	
	

	//Secondary 次要属性
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_MaxHealth, Category = "Vital Attributes")
	FGameplayAttributeData MaxHealth; //最大生命值
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, MaxHealth);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_MaxMana, Category = "Vital Attributes")
	FGameplayAttributeData MaxMana; //最大法力值
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, MaxMana);
	//护甲	Armor	定力
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_Armor, Category = "Secondary Attributes")
	FGameplayAttributeData Armor;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Armor); 
	// 护甲穿透	Armor Penetration	力量
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_ArmorPenetration, Category = "Secondary Attributes")
	FGameplayAttributeData ArmorPenetration;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, ArmorPenetration); 
	// 法术穿透	SpellPenetration	法力/魂力
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_SpellPenetration, Category = "Secondary Attributes")
	FGameplayAttributeData SpellPenetration;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, SpellPenetration); 
	//格挡几率	Block Chance 来源	体魄
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_BlockChance, Category = "Secondary Attributes")
	FGameplayAttributeData BlockChance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, BlockChance); 
	//暴击几率	Critical Hit Chance	来源装备
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_CriticalHitChance, Category = "Secondary Attributes")
	FGameplayAttributeData CriticalHitChance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, CriticalHitChance); 
	//暴击伤害	Critical Hit Damage	来源装备
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_CriticalHitDamage, Category = "Secondary Attributes")
	FGameplayAttributeData CriticalHitDamage;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, CriticalHitDamage); 
	//暴击抗性	Critical Hit Resistance	来源装备
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_CriticalHitResistance, Category = "Secondary Attributes")
	FGameplayAttributeData CriticalHitResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, CriticalHitResistance); 
	//生命恢复	Health Regeneration	来源体魄
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_HealthRegeneration, Category = "Secondary Attributes")
	FGameplayAttributeData HealthRegeneration;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, HealthRegeneration); 
	//法力恢复	Mana Regeneration	来源法力/魂力
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_ManaRegeneration, Category = "Secondary Attributes")
	FGameplayAttributeData ManaRegeneration;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, ManaRegeneration); 
	//移动速度	Movement Speed	来源身法
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_MovementSpeed, Category = "Secondary Attributes")
	FGameplayAttributeData MovementSpeed;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, MovementSpeed); 
	//攻击速度	Attack Speed	来源力量
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_AttackSpeed, Category = "Secondary Attributes")
	FGameplayAttributeData AttackSpeed;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, AttackSpeed);
	//施法速度	Spell Casting Speed	身法
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_SpellCastingSpeed, Category = "Secondary Attributes")
	FGameplayAttributeData SpellCastingSpeed;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, SpellCastingSpeed); 
	//命中几率	Hit Chance	来源身法
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_HitChance, Category = "Secondary Attributes")
	FGameplayAttributeData HitChance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, HitChance);
	//闪避率	Dodge Rate	身法
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_DodgeRate, Category = "Secondary Attributes")
	FGameplayAttributeData DodgeRate;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, DodgeRate); 
	//感知范围	Perception Range	神识
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_PerceptionRange, Category = "Secondary Attributes")
	FGameplayAttributeData PerceptionRange;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, PerceptionRange);
	//召唤物持续时间	Summon Duration	魂力
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_SummonDuration, Category = "Secondary Attributes")
	FGameplayAttributeData SummonDuration;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, SummonDuration);

	//护体罡气 Protective Aura 来源修为等级 和 装备
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_ProtectiveAura, Category = "Secondary Attributes")
	FGameplayAttributeData ProtectiveAura;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, ProtectiveAura); 
	
	/*
	* 抗性属性 Resistance Attributes
	*/
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_PhysicalResistance, Category = "Resistance Attributes")
	FGameplayAttributeData PhysicalResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, PhysicalResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_MagicResistance, Category = "Resistance Attributes")
	FGameplayAttributeData MagicResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, MagicResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_SummonResistance, Category = "Resistance Attributes")
	FGameplayAttributeData SummonResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, SummonResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_FireResistance, Category = "Resistance Attributes")
	FGameplayAttributeData FireResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, FireResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_WaterResistance, Category = "Resistance Attributes")
	FGameplayAttributeData WaterResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, WaterResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_EarthResistance, Category = "Resistance Attributes")
	FGameplayAttributeData EarthResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, EarthResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_WoodResistance, Category = "Resistance Attributes")
	FGameplayAttributeData WoodResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, WoodResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_GoldResistance, Category = "Resistance Attributes")
	FGameplayAttributeData GoldResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, GoldResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_IceResistance, Category = "Resistance Attributes")
	FGameplayAttributeData IceResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, IceResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_LightningResistance, Category = "Resistance Attributes")
	FGameplayAttributeData LightningResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, LightningResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_WindResistance, Category = "Resistance Attributes")
	FGameplayAttributeData WindResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, WindResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_PoisonResistance, Category = "Resistance Attributes")
	FGameplayAttributeData PoisonResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, PoisonResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_DarkResistance, Category = "Resistance Attributes")
	FGameplayAttributeData DarkResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, DarkResistance);
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_ArcaneResistance, Category = "Resistance Attributes")
	FGameplayAttributeData ArcaneResistance;
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, ArcaneResistance);
	
	/*
	* 核心次要属性 Vital Attributes
	*/
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_Health, Category = "Vital Attributes")
	FGameplayAttributeData Health; //生命值
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Health); //属性访问器，UE自动创建 GET SET ，INIT(同时设置基础和当前)等宏
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_Mana, Category = "Vital Attributes")
	FGameplayAttributeData Mana; //法力值
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, Mana);

	//幽灵生命值 - 用于UI显示，在持续恢复效果时立即设置到最终值
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_GhostHealth, Category = "Vital Attributes")
	FGameplayAttributeData GhostHealth; //幽灵生命值
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, GhostHealth);
	//幽灵法力值 - 用于UI显示，在持续恢复效果时立即设置到最终值
	UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_GhostMana, Category = "Vital Attributes")
	FGameplayAttributeData GhostMana; //幽灵法力值
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, GhostMana);
	UFUNCTION()
	void SetGhost(const FGameplayEffectSpecHandle EffectSpecHandle);
	/*
	 * 元属性 Meta Attributes 用于计算伤害,不进行复制 仅在服务端进行计算
	 */
	UPROPERTY(BlueprintReadOnly, Category = "Meta Attributes")
	FGameplayAttributeData IncomingDamage; //伤害元属性
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, IncomingDamage); 

	UPROPERTY(BlueprintReadOnly, Category = "Meta Attributes")
	FGameplayAttributeData IncomingXP; //经验值、修为值元属性
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, IncomingXP);

	UPROPERTY(BlueprintReadOnly, Category = "Meta Attributes")
	FGameplayAttributeData IncomingLingQi; //灵气元属性
	ATTRIBUTE_ACCESSORS(UBaseAttributeSet, IncomingLingQi); 
	

	// UFUNCTION()
	// void OnRep_Level(const FGameplayAttributeData& OldLevel) const;
	// UFUNCTION()
	// void OnRep_XP(const FGameplayAttributeData& OldXP) const;
	// UFUNCTION()
	// void OnRep_LingQi(const FGameplayAttributeData& OldLingQi) const;
	// UFUNCTION()
	// void OnRep_Cultivation(const FGameplayAttributeData& OldCultivation) const;
	// UFUNCTION()
	// void OnRep_CultivationTier(const FGameplayAttributeData& OldCultivationTier) const;
	// UFUNCTION()
	// void OnRep_CultivationStage(const FGameplayAttributeData& OldCultivationStage) const;

	UFUNCTION()
	void OnRep_Strength(const FGameplayAttributeData& OldStrength) const;
	UFUNCTION()
	void OnRep_Intelligence(const FGameplayAttributeData& OldIntelligence) const;
	UFUNCTION()
	void OnRep_SoulPower(const FGameplayAttributeData& OldSoulPower) const;
	UFUNCTION()
	void OnRep_Resilience(const FGameplayAttributeData& OldResilience) const;
	UFUNCTION()
	void OnRep_Vigor(const FGameplayAttributeData& OldVigor) const;
	UFUNCTION()
	void OnRep_Spirit(const FGameplayAttributeData& OldSpirit) const;
	UFUNCTION()
	void OnRep_Agility(const FGameplayAttributeData& OldAgility) const;
	UFUNCTION()
	void OnRep_Insight(const FGameplayAttributeData& OldInsight) const;

	UFUNCTION()
	void OnRep_Health(const FGameplayAttributeData& OldHealth) const;
	UFUNCTION()
	void OnRep_MaxHealth(const FGameplayAttributeData& OldMaxHealth) const;
	UFUNCTION()
	void OnRep_Mana(const FGameplayAttributeData& OldMana) const;
	UFUNCTION()
	void OnRep_MaxMana(const FGameplayAttributeData& OldMaxMana) const;
	UFUNCTION()
	void OnRep_GhostHealth(const FGameplayAttributeData& OldGhostHealth) const;
	UFUNCTION()
	void OnRep_GhostMana(const FGameplayAttributeData& OldGhostMana) const;
	UFUNCTION()
	void OnRep_Armor(const FGameplayAttributeData& OldArmor) const;
	UFUNCTION()
	void OnRep_ArmorPenetration(const FGameplayAttributeData& OldArmorPenetration) const;
	UFUNCTION()
	void OnRep_SpellPenetration(const FGameplayAttributeData& OldSpellPenetration) const;
	UFUNCTION()
	void OnRep_BlockChance(const FGameplayAttributeData& OldBlockChance) const;
	UFUNCTION()
	void OnRep_CriticalHitChance(const FGameplayAttributeData& OldCriticalHitChance) const;
	UFUNCTION()
	void OnRep_CriticalHitDamage(const FGameplayAttributeData& OldCriticalHitDamage) const;
	UFUNCTION()
	void OnRep_CriticalHitResistance(const FGameplayAttributeData& OldCriticalHitResistance) const;
	UFUNCTION()
	void OnRep_HealthRegeneration(const FGameplayAttributeData& OldHealthRegeneration) const;
	UFUNCTION()
	void OnRep_ManaRegeneration(const FGameplayAttributeData& OldManaRegeneration) const;
	UFUNCTION()
	void OnRep_MovementSpeed(const FGameplayAttributeData& OldMovementSpeed) const;
	UFUNCTION()
	void OnRep_AttackSpeed(const FGameplayAttributeData& OldAttackSpeed) const;
	UFUNCTION()
	void OnRep_SpellCastingSpeed(const FGameplayAttributeData& OldSpellCastingSpeed) const;
	UFUNCTION()
	void OnRep_DodgeRate(const FGameplayAttributeData& OldDodgeRate) const;
	UFUNCTION()
	void OnRep_HitChance(const FGameplayAttributeData& OldHitChance) const;
	UFUNCTION()
	void OnRep_PerceptionRange(const FGameplayAttributeData& OldPerceptionRange) const;
	UFUNCTION()
	void OnRep_SummonDuration(const FGameplayAttributeData& OldSummonDuration) const;

	UFUNCTION()
	void OnRep_ProtectiveAura(const FGameplayAttributeData& OldProtectiveAura) const;
	
	UFUNCTION()
	void OnRep_PhysicalResistance(const FGameplayAttributeData& OldPhysicalResistance) const;
	UFUNCTION()
	void OnRep_MagicResistance(const FGameplayAttributeData& OldMagicResistance) const;
	UFUNCTION()
	void OnRep_SummonResistance(const FGameplayAttributeData& OldSummonResistance) const;
	UFUNCTION()
	void OnRep_FireResistance(const FGameplayAttributeData& OldFireResistance) const;
	UFUNCTION()
	void OnRep_WaterResistance(const FGameplayAttributeData& OldWaterResistance) const;
	UFUNCTION()
	void OnRep_EarthResistance(const FGameplayAttributeData& OldEarthResistance) const;
	UFUNCTION()
	void OnRep_WoodResistance(const FGameplayAttributeData& OldWoodResistance) const;
	UFUNCTION()
	void OnRep_GoldResistance(const FGameplayAttributeData& OldGoldResistance) const;
	UFUNCTION()
	void OnRep_IceResistance(const FGameplayAttributeData& OldIceResistance) const;
	UFUNCTION()
	void OnRep_LightningResistance(const FGameplayAttributeData& OldLightningResistance) const;
	UFUNCTION()
	void OnRep_WindResistance(const FGameplayAttributeData& OldWindResistance) const;
	UFUNCTION()
	void OnRep_PoisonResistance(const FGameplayAttributeData& OldPoisonResistance) const;
	UFUNCTION()
	void OnRep_DarkResistance(const FGameplayAttributeData& OldDarkResistance) const;
	UFUNCTION()
	void OnRep_ArcaneResistance(const FGameplayAttributeData& OldArcaneResistance) const;
	
	/* 结束设置属性集 */

private:
	//写入效果属性
	void SetEffectProperties(const FGameplayEffectModCallbackData& Data, FEffectProperties& Props) const;
	//显示浮动伤害数字
	void ShowFloatingText(const FEffectProperties& Props, float Damage, bool bBlockedHit, bool bCriticalHit) const;
	//发送获取修为值、灵气 我把这些整合到一起了 事件
	void SendRewardEvent(const FEffectProperties& Props, const FGameplayTag& GameplayTags) const;
	//处理元伤害
	void HandleIncomingDamage(const FEffectProperties& Props);
	//处理元经验值
	void HandleIncomingXP(const FEffectProperties& Props);
	//处理异常效果
	void HandleDebuff(const FEffectProperties& Props);
	//判断是否是升级补满生命值变量
	bool bTopOffHealth = false;
	//判断是否是升级补满法力值变量
	bool bTopOffMana = false;
};
